package com.ezops.models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "EZOPS_CLIENT_FIELD_MAPPING")
public class ClientEzopsFieldMappingModel implements  DomainEntity{

	

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "CLIENT_FIELD_ID")
	private int clientFieldId;

	@OneToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "CLIENT_FIELD_ID",updatable=false,insertable=false)
	private ClientFields clientField;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "EZOPS_FIELD_ID",updatable=false,insertable=false)
	private EzopsFields ezopsField;
	
	@Column(name = "EZOPS_FIELD_ID")
	private int ezopsFieldId;

	public int getEzopsFieldId() {
		return ezopsFieldId;
	}

	public void setEzopsFieldId(int ezopsFieldId) {
		this.ezopsFieldId = ezopsFieldId;
	}

	public ClientFields getClientField() {
		return clientField;
	}

	public void setClientField(ClientFields clientField) {
		this.clientField = clientField;
	}

	public EzopsFields getEzopsField() {
		return ezopsField;
	}

	public void setEzopsField(EzopsFields ezopsField) {
		this.ezopsField = ezopsField;
	}

	public String getId() {
		return String.valueOf(clientFieldId);
	}

	public void setId(int clientId) {
		this.clientFieldId = clientId;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + clientFieldId;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ClientEzopsFieldMappingModel other = (ClientEzopsFieldMappingModel) obj;
		if (clientFieldId != other.clientFieldId)
			return false;
		return true;
	}

	@Transient
	public int getClientFieldId() {
		return clientFieldId;
	}

	@Transient
	public void setClientFieldId(int clientFieldId) {
		this.clientFieldId = clientFieldId;
	}

}
